<style>
    .dataTable .anvbotton span{background:url(/admins/images/global-button.gif) no-repeat right -177px;height:35px;float:left;padding:0 25px;cursor:pointer;margin-left: 15px;}
    .dataTable .anvbotton:hover{background-position:0 -45px;color:#fff;}
</style>
<form action="/admini/managepay/agentpay" method="get" style="margin:0px">
    <div style=" border:1px solid #DDDDDD; padding:2px; margin:2px;">
        <label for="member">快速搜索：</label><input type="text" id="quick" name="quick" value="<?php echo $this->quick;?>" />
        <input type="submit" id="queryButton" value="查询"/>
    </div>
</form>


<div class="dataTable">
    <table>     
        <tr>
            <th class="w2" width="5%">ID</th>
            <th class="w2" width="5%">代支付编号</th>
            <th class="w3" width="5%">类型</th>
            <th class="w4" width="5%">状态</th>
            <th class="w5" width="10%">用户名</th>
            <th class="w6" width="5%">付款金额</th>
            <th class="w7" width="10%">服务费</th>
            <th class="w8" width="10%">申请时间</th>
            <th class="w9" width="10%">处理时间</th>
            <th class="w10" width="20%">备注</th>
            <th class="w11" width="5%">操作</th>
        </tr>  

        <?php
        if ($this->AgentpayList) {
            foreach ($this->AgentpayList as $Item) {
				if($Item->memberId != ''){
				$ceateTime = strtotime($Item->dateCreated);
				$agentNo = 'D' . (substr($ceateTime, -4, 1) + 1) . $Item->id . substr($ceateTime, -3, 3);				
                ?>
                <tr>
                    <td class="w2" nowrap><a href="/admini/managepay/agentpaydetail/id/<?php echo $Item->id;?>" class="indexa"><?php echo $Item->id; ?></a></td>
                    <td class="w4" nowrap><?php echo $agentNo; ?></td>
                    <td class="w3" nowrap><?php echo $Item->TypeName; ?></td>
                    <td class="w4" nowrap><?php echo $Item->statuscaption; ?></td>
                    <td class="w5" nowrap><?php echo $Item->userinfo->nikename."(".$Item->userinfo->storeno.")"; ?></td>
                    <td class="w6" nowrap><?php echo number_format($Item->payMoney, 2); ?></td>
                    <td class="w7" nowrap><?php echo $Item->processFee; ?></td>
                    <td class="w8" nowrap><?php echo $Item->dateCreated; ?></td>
                    <td class="w9" nowrap><?php echo $Item->dateProcee; ?></td>
                    <td class="w10"><?php echo $Item->remark; ?></td>
                    <td class="w11" align="center"><a href="/admini/managepay/agentpaydetail/id/<?php echo $Item->id;?>"  class="indexa">详情</a></td>
                </tr>
                <?php
			}
            }
        }
        ?>
    </table>
</div>                
<?php echo $this->partial('paging.phtml', array("pages" => $this->agentpayAll,"pamas"=>"quick=$this->quick")); ?>

<script language="javascript">
    $('#procee-button').click(function(){
         var idlist = '';
         $('input[name="ID"]:checked').each(function(){   
                var id = $(this).attr("id");
                id=id.replace(/[^\d]*/ig,"");
		idlist+= id+',';
	});
        if(idlist == ''){
            alert("请选择代支付单");
            return false;
        }else{
            if (confirm( "确定要处理选中的代支付单吗？" )) {
            location.href='/admini/managepay/payagentpay/idlist/'+idlist;
            }
        }
    });
    $('#procee').click(function(){
        var id = $(this).attr("name");
        if (confirm( "确定要处理该代支付单吗？" )) {
            $.post('/admini/managepay/proceepayagent', {'id':id}, function(data){
                if(data.data == 1){
                    alert("处理成功");
                    location.href = "/admini/managepay/agentpay";
                }else{
                    alert("发生未知错误，请重新操作");
                }
            }, 'json');
       }
    });
</script>